package com.zy.mc_module.ui.micang;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewbinding.ViewBinding;
import androidx.viewpager.widget.ViewPager;

import com.flyco.tablayout.SlidingTabLayout;
import com.zy.mc_module.base.kotlin.BaseActivity;
import com.zy.mc_module.databinding.ActivityMineRiceBinding;
import com.zy.mc_module.mvp.base.BasePresenter;
import com.zy.mc_module.mvp.base.IView;
import com.zy.mc_module.ui.micang.fragment.MineRice1Fragment;
import com.zy.mc_module.ui.micang.fragment.MineRiceFragment;
import com.zy.mc_module.utils.AppTools;
import com.zy.mc_module.utils.StatusBarUtil;
import com.zy.mc_module.utils.retrofit.error.ThdException;
import com.zy.mc_module.view.CustomHeadLayout;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * 我的米仓
 */
public class MineRiceActivity extends BaseActivity<IView, BasePresenter<IView>, ActivityMineRiceBinding> {

    private SlidingTabLayout sliding;
    private ViewPager viewPager;

    private final String[] types = {"仓库", "持有中", "已过期"};

    @NonNull
    @Override
    public ActivityMineRiceBinding getViewBinding() {
        return ActivityMineRiceBinding.inflate(getLayoutInflater());
    }

    @Override
    protected void initView() {
        super.initView();

        sliding = binding.slidingtab;
        viewPager = binding.viewpager;
        StatusBarUtil.setImmersiveStatusBar(this);
        binding.customhead.setLeftClickListener(v -> finish());
        initSliding();
    }

    private void initSliding() {
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(MineRiceFragment.getInstance(0));//
        fragments.add(MineRice1Fragment.getInstance(0));//
        fragments.add(MineRice1Fragment.getInstance(1));//
        sliding.setViewPager(viewPager, types, this, fragments);
        sliding.setCurrentTab(0);
    }

}
